/**
 * <p>Copyright (c) 2017 深圳市鹏途交通科技有限公司 </p>
 * <p>				   All right reserved. 		     </p>
 * 
 * <p>项目名称 ： 	         </p>
 * <p>创建者   :	heyong 
 * 
 * <p>描   述  :   StandardManagementServiceImpl.java for com.pengtu.gsj.service.impl.gcjs    </p>
 * 
 * <p>最后修改 : $: 2017年6月28日-上午11:40:16 v 1.0.0	 win7   $ </p>
 * 
*/

package com.pengtu.gsj.service.impl.gcjs;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pengtu.gsj.dao.base.Page;
import com.pengtu.gsj.dao.base.QueryFilter;
import com.pengtu.gsj.dao.check.gcjs.StandardManagementDao;
import com.pengtu.gsj.entity.app.Attachment;
import com.pengtu.gsj.entity.gcjs.StandardManagement;
import com.pengtu.gsj.service.gcjs.StandardManagementService;
import com.pengtu.gsj.service.system.SystemManageService;

/**
 * 
 * StandardManagementServiceImpl
 * 
 * 2017年6月28日 上午11:40:16
 * 
 * @version 1.0.0
 * 
 */
@Service
@Transactional
public class StandardManagementServiceImpl implements StandardManagementService{
	
	@Autowired
	private StandardManagementDao standardManagementDao;
	
	@Autowired
	private SystemManageService systemManageService;
	
	
	
	@Override
	public void saveStandardManagement(StandardManagement standardManagement){
		standardManagementDao.save(standardManagement);
	}
	
	@Override
	public Page<StandardManagement> findStandardManagement(Page<StandardManagement> page, final QueryFilter queryFilter){
		return standardManagementDao.findPage(page, queryFilter);
	}
	
	@Override
	public StandardManagement getStandardManagementById(String id){
		return standardManagementDao.get(id);
	}
	
	@Override
	public void  delateStandardManagement(StandardManagement standardManagement){
		if(standardManagement.getAttachments() != null){
			for(Attachment attachment : standardManagement.getAttachments()){
				systemManageService.deleteAttachment(attachment);
			}
		}
		standardManagementDao.delete(standardManagement);
	}
}
